import { Component, OnInit } from '@angular/core';
import { Student } from './student';

@Component({
    selector: 'app-message',
    templateUrl: './my.component.html'
    // template: '<p>This is some message</p>'
})

export class MyComponent implements OnInit {

    private _message: string = "This is some message from component!";

    public get message(): string {
        return this._message;
    }
    public set message(value: string) {
        this._message = value;
    }

    public group: Student[] = [
        {
            name: 'Anduin',
            age: 18
        },
        {
            name: 'Yolo',
            age: 18
        },
        {
            name: 'Lily',
            age: 18
        }
    ];

    public addStudent( name:string, age: number) {
        this.group.push(
            {
                name: name,
                age: age
            }
        )
    }

    constructor() { }

    ngOnInit() { }
}